var typeList = null;
var navList;
var iconList;
var DEFAULT_IMG = 'images/default_m.png';
$(function(){ 
	navList = new NavList({				//初始化左边导航
		id:'navBox',
		moveRight:function(){			//向右事件
			iconList.setFocus();
		},
		onclick:function(data,id){
			$('#nav').html(data.name);
				loadDataList(data);
		}
	});
	
	
	iconList = new IconList({			//初始化右边导航
		id:'listBox',
		moveLeft:function(){
			navList.setFocus();
		},
		formatHtml:function(i,row,data){
			var img = $.getImageUrl(data.image,DEFAULT_IMG); 
			var con = '<div class="icon">';
				con += '<img src="'+img+'" />';
				con += '<a href="#" id="'+this.target+'-a-'+i+'" tar="'+i+'" row="'+row+'">&nbsp;</a>';
			con += '</div>';
			return con;
		},
		onfocus:function(data,id){
			$.log('on focus item');
			var describe=(data.describe.length>100)?data.describe.substr (0,100):data.describe;
			$("#rightDisplay").html("<h1>"+data.name+"<h1><br/><br/><br/><p>"+describe+"</p>")
		},
		onclick:function(data,id){
			$.log($.toJSON(data));
		},
		loadDataListListener:function(data,page,callback){
				loadDataList(data,page,callback);
				
		}
	}); 
	
	typeList = initData();
	navList.setDataList(typeList,true);
	navList.Click(1);
});

function afterLoadDataList(data,list){
	data.dataList = list.list;
	iconList.setDataList(data.dataList);
}


